<template>
	<view class="mainContent">
		<view class="twoSecond">
			<view class="left">
				<p class="flex">用药时间：
					<picker mode="date" :disabled="status == 1"  @change="bindDateChange">
						<view class="date">{{startDate || '选择用药时间'}}</view>
					</picker> 
				</p>
				<view><text>用药名称：</text><input type="text" v-model="drugsName" :disabled="status == 2"></view>
			</view>
			<view class="right"></view>
		</view>
		<view class="uploadBox">
			<u-upload  ref="uUpload" :header="header" :form-data="{type:12}" :action="action" :file-list="imgUrls" :deletable="status != 1" @on-uploaded="uploaded"></u-upload>
		</view>
	</view>
</template>

<script>
	import http from '@/common/http/interface.js'
	import {getUrlParam} from "@/static/js/filter.js"
	export default {
		data () {
			return {
				action: http.config.baseUrl+'/File/multipleFiles',
				header:{
					"Token": localStorage.token
				},
				status:'', 
				showContent:'',
				drugsName: '',
				startDate: '',
				defaultArr: [],
				imgUrls: [],
			}
		},
		onLoad() {
			this.id = getUrlParam('id');
			if(this.id) {
				this.$api.memberFindByDrugs(this.id).then((res) => {
					this.startDate = res.data.result.startDate
					this.drugsName = res.data.result.drugsName
					this.status = res.data.result.status
					this.imgUrls = res.data.result && res.data.result.urlList.map((a)=>{
						return {url:a}
					})
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.mainContent {
		width: 750upx;
		min-height: calc(100vh - 44px);
		background-color: #FFFFFF;
		.twoSecond {
			width: 750upx;
			height: 176upx;		
			background: #F5FFFB;
			// box-shadow: 0upx 4upx 30upx 0upx rgba(222, 222, 222, 0.3);
			display: flex;
			position: fixed;
			top: 44px;
			align-items: center;
			padding: 0 24upx;
			box-sizing: border-box;
			z-index: 200;
			.left {
				flex: 1;
				width: 702upx;
				view {
					display: flex;
					align-items: center;
					text {
						color: #333333;
						font-size: 30upx;
					}				
					input {
						width: 319upx;
						height: 46upx;
						padding-left: 10upx;
						border: 1upx solid #E4E4E4;
						border-radius: 6upx;
						display: inline-block;
						margin: 10upx 0;
					}
				}
			}
			.right {
				height: 108upx;
				view {
					width: 174upx;
					height: 46upx;
					background: #FF8F23;
					border-radius: 8upx;
					color: #FFFFFF;
					font-size: 30upx;
					text-align: center;
					line-height: 46upx;
				}
				.saveSure {
					background-color: #38CB97;
					line-height: 108upx;
					height: 100%;
				}
			}
		}
		.uploadBox {
			margin-top: 200rpx;
			width: 750upx;
			padding: 0 60upx;
			box-sizing: border-box;
			display: flex;
			flex-wrap: wrap;
			.u-upload{
				width: 100%;
				display: flex;
				justify-content: space-between;
				/deep/ .u-list-item {
					width: 266upx !important;
					height: 350upx !important;
					background: #EFEFEF;
					border-radius: 10upx;
					position: relative;
				}
			}
		}
	}
	.flex{
		display: flex;
		font-size: 30rpx;
		.date{
			width: 334upx;
			height: 50upx;
			padding-left: 10upx;
			border: 1upx solid #E4E4E4;
			border-radius: 6upx;
		}
	}
</style>

